-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(copilot): add best practices for core blocks #1427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR enhances the Sim platform's copilot capabilities by adding contextual best practices to all block configurations. The implementation adds a new optional bestPractices field to the BlockConfig interface and populates it across 15+ core workflow blocks including Agent, API, Function, Memory, and various triggers.
Key Changes:
- Type System: Added optional
bestPractices?: stringfield toBlockConfiginterface intypes.ts - Block Configurations: Each block now includes tailored guidance covering common usage patterns, gotchas, and recommendations
- Metadata Tool: Updated
get-blocks-metadata-tool.tsto extract and expose best practices through the copilot's metadata API - Special Blocks: Added best practices for loop and parallel control flow blocks in the metadata tool
Best Practices Content Quality:
- Agent Block: Comprehensive guidance on tool restrictions, YAML syntax, and response format usage
- Function Block: Clear direction on execution modes (remote vs local) and variable referencing
- API Trigger: Detailed examples including production curl commands and variable access patterns
- Memory Block: Integration guidance with agent blocks for conversation persistence
The implementation follows a consistent pattern across all blocks, providing practical, actionable guidance that will help the copilot provide better contextual assistance to users building workflows.
Confidence Score: 4/5
- This PR is safe to merge with minor text corrections needed
- Score reflects clean type system changes and comprehensive documentation additions. Only minor typos in memory block prevent a perfect score. The implementation is consistent, follows established patterns, and enhances user experience without introducing breaking changes.
- apps/sim/blocks/blocks/memory.ts contains typos that should be fixed
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/blocks/types.ts | 5/5 | Added optional bestPractices field to BlockConfig interface - clean type definition change |
| apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts | 5/5 | Updated metadata tool to include bestPractices in CopilotBlockMetadata interface and added to metadata extraction logic |
| apps/sim/blocks/blocks/agent.ts | 5/5 | Added comprehensive best practices for Agent blocks covering tool usage, custom tools YAML syntax, and response format |
| apps/sim/blocks/blocks/function.ts | 5/5 | Added detailed best practices for Function block covering Python/JavaScript execution modes and variable referencing |
| apps/sim/blocks/blocks/memory.ts | 3/5 | Added best practices for Memory block with YAML syntax guidance and agent integration, but contains typos |
| apps/sim/blocks/blocks/api_trigger.ts | 5/5 | Added comprehensive best practices for API trigger including manual testing, variable access patterns, and production curl examples |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant UI as Sim UI
participant Copilot as Copilot Agent
participant MetadataTool as get-blocks-metadata-tool
participant BlockRegistry as Block Registry
participant BlockConfig as Block Configuration
Note over Dev,BlockConfig: PR #1427: Adding Best Practices to Block Configs
Dev->>BlockConfig: Add bestPractices field to BlockConfig interface
Dev->>BlockConfig: Implement bestPractices in all 15+ block definitions
Note over BlockConfig: Each block now includes contextual guidance:<br/>- Agent: tool usage, YAML syntax<br/>- API: endpoint testing recommendations<br/>- Function: execution mode guidance<br/>- Memory: integration with agents<br/>- etc.
Dev->>MetadataTool: Update CopilotBlockMetadata interface
Dev->>MetadataTool: Add bestPractices extraction logic
Dev->>MetadataTool: Add bestPractices for loop/parallel special blocks
Note over UI,Copilot: Runtime: Enhanced Copilot Context
UI->>Copilot: User requests workflow assistance
Copilot->>MetadataTool: get_blocks_metadata(blockIds)
MetadataTool->>BlockRegistry: Retrieve block configurations
BlockRegistry-->>MetadataTool: Block configs with bestPractices
MetadataTool-->>Copilot: Enhanced metadata including best practices
Copilot->>UI: Provide contextual guidance using best practices
17 files reviewed, 2 comments
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…im into improvement/best-prac-meta
* improvement(copilot): add best practices for blocks * fix kb, api * Update apps/sim/blocks/blocks/memory.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * address comments * remove non deterministic test --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Summary
Add best practices field to block config and get blocks metadata tool to give more context on Sim-native core blocks.
Type of Change
Testing
Manually
Checklist